xen.git
17 years agoXendAPIStore - do not remove non-existent item
Keir Fraser [Wed, 4 Feb 2009 11:57:17 +0000 (11:57 +0000)]
XendAPIStore - do not remove non-existent item

If list is searched and item not found, then don't attempt to delete
the item.

Signed-off-by: Jim Fehlig <jfehlig@novell.com>
17 years agox86: avoid redundant TLB flushes
Keir Fraser [Tue, 3 Feb 2009 18:14:19 +0000 (18:14 +0000)]
x86: avoid redundant TLB flushes

While in some places the guest requested flushes were already folded
into the deferred ops, this wasn't done consistently.

Also avoid using an uninitialized variable, even if doing so has no
correctness issue.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86: misc adjustments to acpi-cpufreq
Keir Fraser [Tue, 3 Feb 2009 18:13:55 +0000 (18:13 +0000)]
x86: misc adjustments to acpi-cpufreq

Avoid the call to check_freq() by default, since that function may
spin up to 1ms on certain systems without indicating any kind of severe
failure. This matches similar behavior in Linux.

Avoid doing a cross processor call in get_cur_val() if the current CPU
has its bit set in the mask passed in. Also use the local variable
'cpu' consistently, allowing to remove another local variable.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agocpufreq: attach __exit to the (unused) cpufreq governor exit handlers
Keir Fraser [Tue, 3 Feb 2009 18:13:22 +0000 (18:13 +0000)]
cpufreq: attach __exit to the (unused) cpufreq governor exit handlers

... in order to make them disappear from the final image. Of course
they could as well be removed altogether, but I assumed that whoever
added them had a reason to do so.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agoConsolidate cpufreq cmdline handling
Keir Fraser [Tue, 3 Feb 2009 18:12:51 +0000 (18:12 +0000)]
Consolidate cpufreq cmdline handling

... by moving as much of the option processing into cpufreq code as is
possible, by folding the cpufreq_governor option into the cpufreq one
(the governor name, if any, must be specified as the first thing after
the separator following "cpufreq=xen"), and by allowing each
governor to have an option processing routine.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86: Relocate Multiboot structures where we know they will be
Keir Fraser [Tue, 3 Feb 2009 18:11:03 +0000 (18:11 +0000)]
x86: Relocate Multiboot structures where we know they will be
accessible. GRUB2 seems to like to stick them really high sometimes
(just below 4GB).

The 32-bit C code framework that this sets up can also be used for
other stuff in future:
 * early cmdline parsing
 * relocating multiboot modules so they too are guaranteed accessible

Its interaction with normal Xen start-of-day, and with the 16-bit
assembly trampoline, needs a bit of thought.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoia64: fix compilation error
Keir Fraser [Tue, 3 Feb 2009 14:06:51 +0000 (14:06 +0000)]
ia64: fix compilation error

This patch fixes the following compilation error.
Since struct page_list_head is defined in mm.h, sched.h needs mm.h.
Other circular inclusions are sorted out.

> In file included from xen/include/asm-ia64/linux-xen/asm/smp.h:50,
>                  from xen/include/linux/smp.h:5,
>                  from xen/include/asm-ia64/linux/topology.h:33,
>                  from xen/include/asm-ia64/linux-xen/linux/gfp.h:6,
>                  from xen/include/asm/mm.h:11,
>                  from xen/include/xen/mm.h:90,
>                  from viosapic.c:35:
> xen/include/xen/sched.h:174: error: field page_list has incomplete
> type
> xen/include/xen/sched.h:175: error: field xenpage_list has
> incomplete type

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
17 years agox86/shadow: struct page_info's type_info is now unsigned long,
Keir Fraser [Tue, 3 Feb 2009 14:03:32 +0000 (14:03 +0000)]
x86/shadow: struct page_info's type_info is now unsigned long,

hence local variables of type u32 (and the more such with misleading
names) must no longer be used.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agoFix 'debug ?= y' to actually enable debug build.
Keir Fraser [Mon, 2 Feb 2009 09:21:04 +0000 (09:21 +0000)]
Fix 'debug ?= y' to actually enable debug build.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: page_info cleanups.
Keir Fraser [Fri, 30 Jan 2009 11:33:27 +0000 (11:33 +0000)]
x86: page_info cleanups.
 1. No reason for i386 not to use the same definitions as x64
 2. No need for shadow_page_info names to hang around.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agopage_alloc: try to put heap control structures on the target node
Keir Fraser [Fri, 30 Jan 2009 11:16:52 +0000 (11:16 +0000)]
page_alloc: try to put heap control structures on the target node

This also neatly eliminates (in certain cases) the need to reserve a
page between nodes, as the heap control structures will never be freed
and thus can serve as the needed separator.

It also adds an additonal fallback attempting to make use of the
wasted tail of a (group of) page(s) used for the _heap array by putting the
avail array there if it fits.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agopage_alloc: properly honor MAX_ORDER in init_heap_pages()
Keir Fraser [Fri, 30 Jan 2009 11:14:23 +0000 (11:14 +0000)]
page_alloc: properly honor MAX_ORDER in init_heap_pages()

The previous check was flawed in that it checked
- for a single bit to be set instead of a range of bits to be clear
- a machine address against a mask supposed to be used on MFNs.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agopass-through: drop lock before calling xfree() on error path
Keir Fraser [Fri, 30 Jan 2009 11:13:55 +0000 (11:13 +0000)]
pass-through: drop lock before calling xfree() on error path

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agoamd-iommu: drop locks before printing error messages
Keir Fraser [Fri, 30 Jan 2009 11:13:32 +0000 (11:13 +0000)]
amd-iommu: drop locks before printing error messages

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agoamd-iommu: obtain page_alloc_lock before traversing a domain's page list
Keir Fraser [Fri, 30 Jan 2009 11:13:06 +0000 (11:13 +0000)]
amd-iommu: obtain page_alloc_lock before traversing a domain's page list

From all I can tell, this doesn't violate lock ordering as other
places call heap allocation functions from inside hd->mapping_lock.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86: re-arrange struct page_info members
Keir Fraser [Fri, 30 Jan 2009 11:10:43 +0000 (11:10 +0000)]
x86: re-arrange struct page_info members

By combining the overlay fields that are 8 bytes long (on x86-64) into
a union separate from the one used for the 4 byte wide fields, no
unnecessary padding will be inserted while at the same time avoiding
to use __attribute__((__packed__)) on any of the sub-structures (which
risks misaligning structure members without immediately noticing).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86-64: use MFN also for next_shadow link
Keir Fraser [Fri, 30 Jan 2009 11:09:44 +0000 (11:09 +0000)]
x86-64: use MFN also for next_shadow link

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86-64: fold shadow_page_info fields into page_info
Keir Fraser [Fri, 30 Jan 2009 11:08:06 +0000 (11:08 +0000)]
x86-64: fold shadow_page_info fields into page_info

... combining the list entry members of both structures and removing
the artificial 'mbz' member (shadow code must keep the real underlying
member 'count_info' at zero for the lifetime of pages use as shadows).

This also fixes a latent issue with u.inuse._domain not getting
explicitly cleared before returning shadow pages to the domain heap -
it just so happened that this member turned out to be zero in all
(normal?) cases when a shadow page ends its life (but there were
neither build nor run-time assertions that this would actually be the
case). The bug got exposed by a subsequent patch changing the order of
fields in struct page_info.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86: Better bzimage_headroom() crash fix.
Keir Fraser [Fri, 30 Jan 2009 11:04:24 +0000 (11:04 +0000)]
x86: Better bzimage_headroom() crash fix.
Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
17 years agox86-64: use MFNs for linking together pages on lists
Keir Fraser [Fri, 30 Jan 2009 11:03:28 +0000 (11:03 +0000)]
x86-64: use MFNs for linking together pages on lists

Unless more than 16Tb are going to ever be supported in Xen, this will
allow reducing the linked list entries in struct page_info from 16 to
8 bytes.

This doesn't modify struct shadow_page_info, yet, so in order to meet
the constraints of that 'mirror' structure the list entry gets
artificially forced to be 16 bytes in size. That workaround will be
removed in a subsequent patch.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86_64: Remove bogus extra do_xsm_op from hypercall_args_table
Keir Fraser [Fri, 30 Jan 2009 10:51:01 +0000 (10:51 +0000)]
x86_64: Remove bogus extra do_xsm_op from hypercall_args_table
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years ago[IA64] remove static-partitioned xenheap
Isaku Yamahata [Fri, 30 Jan 2009 02:12:57 +0000 (11:12 +0900)]
[IA64] remove static-partitioned xenheap

This patch is ia64 counter part of 19054:845aa241e163

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
17 years ago[IA64] Widen page counts and domain pointer
Isaku Yamahata [Fri, 30 Jan 2009 02:12:44 +0000 (11:12 +0900)]
[IA64] Widen page counts and domain pointer

This is ia64 counter part of 19089:39517e863cc8.
This patch is preliminary for removing xenheap.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
17 years ago[IA64] No need for cmpxchg on page_info structure.
Isaku Yamahata [Fri, 30 Jan 2009 02:12:29 +0000 (11:12 +0900)]
[IA64] No need for cmpxchg on page_info structure.

Updates and checks on count_info and page owner can safely be
non-atomic.
This is ia64 counter part of 19088:055c589f4791.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
17 years ago[IA64] fix __virt_to_maddr()
Isaku Yamahata [Fri, 30 Jan 2009 02:12:03 +0000 (11:12 +0900)]
[IA64] fix __virt_to_maddr()

__virt_to_maddr() should be updated acording to xen relocation.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
17 years ago[IA64] use domheap for mpt_table.
Isaku Yamahata [Fri, 30 Jan 2009 02:11:39 +0000 (11:11 +0900)]
[IA64] use domheap for mpt_table.

Now there is no need to allocate pages for mpt_table from xenheap.
So allocate it from domheap.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
17 years ago[IA64] remove opt_p2m_xenheap
Isaku Yamahata [Fri, 30 Jan 2009 02:09:27 +0000 (11:09 +0900)]
[IA64] remove opt_p2m_xenheap

xenheap isn't pinned down now so that allocating p2m pages from
xenheap doesn't make sense anymore.
This is preparation for removing xenheap.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
17 years ago[IA64] remove warning
Isaku Yamahata [Fri, 30 Jan 2009 02:04:51 +0000 (11:04 +0900)]
[IA64] remove warning

This patch remove the following warning.
> memory.c:116: warning: implicit declaration of function 'guest_physmap_mark_populate_on_demand'
> memory.c:206: warning: implicit declaration of function 'p2m_pod_decrease_reservation'

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
17 years agomerge with xen-unstable.hg
Isaku Yamahata [Fri, 30 Jan 2009 01:54:13 +0000 (10:54 +0900)]
merge with xen-unstable.hg

17 years agox86: Fix the build.
Keir Fraser [Thu, 29 Jan 2009 23:40:37 +0000 (23:40 +0000)]
x86: Fix the build.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agostubdom: add videoram to stubdom initial memory reservation
Keir Fraser [Thu, 29 Jan 2009 16:41:48 +0000 (16:41 +0000)]
stubdom: add videoram to stubdom initial memory reservation

This patch adds a videoram parameter (4MB is the default) to pv guests
too: if the pv guest is actually a stubdomain then the videoram size
is added to the initial required available memory.
This way there is no risk that a stubdom fails to populate the
videoram because the RAM freed for the videoram by dom0 has already
been used to create the stubdom.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
17 years agoPoD: Check refcount, not type count when reclaiming zero pages
Keir Fraser [Thu, 29 Jan 2009 16:40:48 +0000 (16:40 +0000)]
PoD: Check refcount, not type count when reclaiming zero pages

Check the page refcount rather than the type count when deciding if a
page is still mapped.

This catches pages which are mapped by qemu; it also removes the need
for gnttab_is_granted().

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
17 years agoxend: Fix block device type check
Keir Fraser [Thu, 29 Jan 2009 16:39:56 +0000 (16:39 +0000)]
xend: Fix block device type check

Since changeset 17617 the block device protocols are checked to be
either file or phy. This has later been fixed to also include
tap. This is still not a correct check as there can be arbitrary
additional protocols. Before this check was added you could have a
block-xyz hotplug script and xyz would work as a protocol, now it is
refused. An example for this mechanism is the block-nbd script which
is included in the tree.

This patch changes the check to allow file, phy, tap and all protocol
names for which a block-$protocol hotplug script exists. This should
fix the last regressions introduced by the check.

Signed-off-by: Kevin Wolf <kwolf@suse.de>
17 years agoPoD: Remove on-stack arrays from pod_zero_check_superpage
Keir Fraser [Thu, 29 Jan 2009 12:48:33 +0000 (12:48 +0000)]
PoD: Remove on-stack arrays from pod_zero_check_superpage

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
17 years agotboot: use TXT's DMA-protected DMAR table to setup VT-d
Keir Fraser [Thu, 29 Jan 2009 12:44:31 +0000 (12:44 +0000)]
tboot: use TXT's DMA-protected DMAR table to setup VT-d

Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
17 years agotboot: tboot no longer marks TXT regions as E820_UNUSABLE, so Xen must
Keir Fraser [Thu, 29 Jan 2009 12:10:39 +0000 (12:10 +0000)]
tboot: tboot no longer marks TXT regions as E820_UNUSABLE, so Xen must
explicitly disallow them itself.

Signed-off-by: Shane Wang <shane.wang@intel.com>
Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
17 years agotboot: hypervisor integrity on S3
Keir Fraser [Thu, 29 Jan 2009 11:36:09 +0000 (11:36 +0000)]
tboot: hypervisor integrity on S3

When launched from tboot, utilise tboot interface to provide integrity
protection to the hypervisor during S3

Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
ACKed-by: Shane Wang <shane.wang@intel.com>
17 years agotboot: ACPI Generic Address Structure for tboot shutdown
Keir Fraser [Thu, 29 Jan 2009 11:35:19 +0000 (11:35 +0000)]
tboot: ACPI Generic Address Structure for tboot shutdown

New versions of tboot support ACPI GAS (Generic Address Structure) for
handling sleep states.  This required a change to the tboot_shared_t
data structure that is not backwards compatible.  This patch requires
that new version makes use of GAS when invoking tboot on shutdown.

Signed-off-by: Shane Wang <shane.wang@intel.com>
Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
17 years agotboot: single tboot entry point for shutdown
Keir Fraser [Thu, 29 Jan 2009 11:32:06 +0000 (11:32 +0000)]
tboot: single tboot entry point for shutdown

tboot removed the shutdown_entry32 and shutdown_entry64 from
tboot_shared_t and now has just a single shutdown_entry field.

Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
17 years agox86: Although bzimage_headroom() doesn't return -ve values,
Keir Fraser [Thu, 29 Jan 2009 11:28:09 +0000 (11:28 +0000)]
x86: Although bzimage_headroom() doesn't return -ve values,
bzimage_parse() can.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: bzimage_headroom does not return -ve error codes.
Keir Fraser [Thu, 29 Jan 2009 01:16:30 +0000 (01:16 +0000)]
x86: bzimage_headroom does not return -ve error codes.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Do not check dom0 kernel header for bzimage magic until we are
Keir Fraser [Thu, 29 Jan 2009 01:11:50 +0000 (01:11 +0000)]
x86: Do not check dom0 kernel header for bzimage magic until we are
sure it is mapped. This fixes a crash when running on top of tboot.

Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
17 years agox86: Pickle domain in page_info into 32 bits.
Keir Fraser [Wed, 28 Jan 2009 17:40:01 +0000 (17:40 +0000)]
x86: Pickle domain in page_info into 32 bits.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: VCPU structure must reside below 4GB, since it contains embedded
Keir Fraser [Wed, 28 Jan 2009 17:05:18 +0000 (17:05 +0000)]
x86: VCPU structure must reside below 4GB, since it contains embedded
PAE mode PDPTEs.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoAllow memflags to be specified to alloc_xenheap_pages().
Keir Fraser [Wed, 28 Jan 2009 16:58:41 +0000 (16:58 +0000)]
Allow memflags to be specified to alloc_xenheap_pages().

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agomerge with xen-unstable.hg
Isaku Yamahata [Wed, 28 Jan 2009 04:06:45 +0000 (13:06 +0900)]
merge with xen-unstable.hg

17 years ago[IA64] support XEN_DOMCTL_[gs]et_address_size
Isaku Yamahata [Wed, 28 Jan 2009 03:22:58 +0000 (12:22 +0900)]
[IA64] support XEN_DOMCTL_[gs]et_address_size

support XEN_DOMCTL_[gs]et_address_size to support
the updated xm dump-core.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
17 years agoacpi: Neaten reboot messages.
Keir Fraser [Tue, 27 Jan 2009 16:41:09 +0000 (16:41 +0000)]
acpi: Neaten reboot messages.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Fold page_info lock into type_info.
Keir Fraser [Tue, 27 Jan 2009 16:02:21 +0000 (16:02 +0000)]
x86: Fold page_info lock into type_info.

Fix some racey looking code at the same time.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86-64: don't generate dependency files when building compat headers
Keir Fraser [Tue, 27 Jan 2009 11:54:22 +0000 (11:54 +0000)]
x86-64: don't generate dependency files when building compat headers

The generated dependency files weren't correct (as their names get
derived only from the base name of the target file, and there are
public headers with the same base name in different directories), not
needed (as the makefile already listed all necessary dependencies
explicitly), and resulted in the first re-build in an already built
tree to be an almost full re-build since the *.c files explicitly
mentioned in the .*.d result in make not considering them as
intermediate anymore, thus triggering re-generation of the headers,
and hence re-building of almost the entire tree.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86: clean up struct page_info
Keir Fraser [Tue, 27 Jan 2009 11:45:59 +0000 (11:45 +0000)]
x86: clean up struct page_info

Remove the now unnecessary (and leading to misalignment of cpumask on
x86-64) 'packed' attributes.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86: use alloc_domheap_page() consistently in dom0 building
Keir Fraser [Tue, 27 Jan 2009 11:24:47 +0000 (11:24 +0000)]
x86: use alloc_domheap_page() consistently in dom0 building

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86: clean up comments in mce_intel.c
Keir Fraser [Tue, 27 Jan 2009 11:24:24 +0000 (11:24 +0000)]
x86: clean up comments in mce_intel.c

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agomake pirq_acktype() static to its respective source files
Keir Fraser [Tue, 27 Jan 2009 11:23:56 +0000 (11:23 +0000)]
make pirq_acktype() static to its respective source files

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86-64: also use 1G page mappings for M2P table
Keir Fraser [Tue, 27 Jan 2009 11:23:30 +0000 (11:23 +0000)]
x86-64: also use 1G page mappings for M2P table

Also, specify the node for the respective page table allocations.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
17 years agox86: Fix shadow_check_page_struct_offsets() comment.
Keir Fraser [Tue, 27 Jan 2009 10:25:33 +0000 (10:25 +0000)]
x86: Fix shadow_check_page_struct_offsets() comment.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86_64: shared_info must be allocated below 4GB as it is advertised to
Keir Fraser [Mon, 26 Jan 2009 23:36:59 +0000 (23:36 +0000)]
x86_64: shared_info must be allocated below 4GB as it is advertised to
32-bit guests via a 32-bit machine address field in start_info.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Small improvements to mm.c
Keir Fraser [Mon, 26 Jan 2009 23:35:47 +0000 (23:35 +0000)]
x86: Small improvements to mm.c
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Clean up shadow_page_info after page_info changes.
Keir Fraser [Mon, 26 Jan 2009 16:52:38 +0000 (16:52 +0000)]
x86: Clean up shadow_page_info after page_info changes.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoxenoprof: Fix code indentation.
Keir Fraser [Mon, 26 Jan 2009 16:34:51 +0000 (16:34 +0000)]
xenoprof: Fix code indentation.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Clean up pickle_domptr().
Keir Fraser [Mon, 26 Jan 2009 16:34:16 +0000 (16:34 +0000)]
x86: Clean up pickle_domptr().
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86_64: No restriction on Xen heap address width.
Keir Fraser [Mon, 26 Jan 2009 16:21:21 +0000 (16:21 +0000)]
x86_64: No restriction on Xen heap address width.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86_64: Widen page counts to avoid overflow.
Keir Fraser [Mon, 26 Jan 2009 16:19:42 +0000 (16:19 +0000)]
x86_64: Widen page counts to avoid overflow.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: No need for CMPXCHG8B on page_info structure.
Keir Fraser [Mon, 26 Jan 2009 14:56:19 +0000 (14:56 +0000)]
x86: No need for CMPXCHG8B on page_info structure.

Updates and checks on count_info and page owner can safely be
non-atomic.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agorombios: fix pointer argument to PMM
Keir Fraser [Mon, 26 Jan 2009 11:22:03 +0000 (11:22 +0000)]
rombios: fix pointer argument to PMM

The pointer to PMM function arguments must be flattened for protected
mode with zero-based segments.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
17 years agorombios: fix wrong stack segment return in 32-bit gateway
Keir Fraser [Mon, 26 Jan 2009 11:16:52 +0000 (11:16 +0000)]
rombios: fix wrong stack segment return in 32-bit gateway

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
17 years agoRename memory_is_conventional_ram() to page_is_conventional_ram().
Keir Fraser [Sun, 25 Jan 2009 10:32:26 +0000 (10:32 +0000)]
Rename memory_is_conventional_ram() to page_is_conventional_ram().
It now checks that a whole contiguous page is conventional RAM.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agovt-d: Do not explicitly exclude tboot ranges from dom0 vt-d
Keir Fraser [Sun, 25 Jan 2009 10:16:11 +0000 (10:16 +0000)]
vt-d: Do not explicitly exclude tboot ranges from dom0 vt-d
mappings. tboot is not registered as RAM in e820 tables, and hence
will not be mapped anyway (fails memory_is_conventional_ram() check).

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Fix memory_is_conventional_ram() e820 entry size check.
Keir Fraser [Sun, 25 Jan 2009 10:12:38 +0000 (10:12 +0000)]
x86: Fix memory_is_conventional_ram() e820 entry size check.

Thanks to Joe Cihula for spotting this.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agovt-d: Exclude non-RAM pages (as reported by boot firmware) from dom0 mappings.
Keir Fraser [Sat, 24 Jan 2009 09:25:25 +0000 (09:25 +0000)]
vt-d: Exclude non-RAM pages (as reported by boot firmware) from dom0 mappings.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86_64, vt-d: Do not include pages 'in xen range' which may be freed
Keir Fraser [Sat, 24 Jan 2009 09:24:46 +0000 (09:24 +0000)]
x86_64, vt-d: Do not include pages 'in xen range' which may be freed
to domain heap.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoFix ia64 build.
Keir Fraser [Fri, 23 Jan 2009 16:50:09 +0000 (16:50 +0000)]
Fix ia64 build.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoEPT/VT-d: Enhance MTRR/PAT virtualization when EPT/VT-d both enabled
Keir Fraser [Fri, 23 Jan 2009 14:42:29 +0000 (14:42 +0000)]
EPT/VT-d: Enhance MTRR/PAT virtualization when EPT/VT-d both enabled

Set effective memory type for EPT according to the VT-d snoop control
capability, and also includes some cleanups for EPT & VT-d both enabled.

Signed-off-by: Edwin Zhai <Edwin.Zhai@intel.com>
Signed-off-by: Xiaohui Xin <xiaohui.xin@intel.com>
17 years agorombios: Indirect through 32-bit jump table from within the 32-bit bios.
Keir Fraser [Fri, 23 Jan 2009 14:32:41 +0000 (14:32 +0000)]
rombios: Indirect through 32-bit jump table from within the 32-bit bios.

This gets rid of shenanigans with relocating the jump table around the
place.

Also clean up bios_info table while we are updating it.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agohvm bios: add PMM (a memory manager during POST)
Keir Fraser [Fri, 23 Jan 2009 12:50:14 +0000 (12:50 +0000)]
hvm bios: add PMM (a memory manager during POST)

The PMM (POST Memory Manager) offers malloc/free functionality
for PCI option ROMs during POST (Power On Self Test).

This patch adds a PMM functionality to the guest BIOS.

For example, the option ROM on LSI Logic SAS card uses PMM and
failed to initialize the device without PMM.  Thus, the HVM can't
boot up directly from the passthroughed SCSI disk.
gPXE also uses PMM (I don't know what happens without PMM).

With this patch, we succeeded in SAS boot of HVM.

For further information about PMM:
http://www.phoenix.com/en/OEM-ODM/Customer+Services/White+Papers-Specs/PC+Industry+Specifications.htm
http://www.phoenix.com/NR/rdonlyres/873A00CF-33AC-4775-B77E-08E7B9754993/0/specspmm101.pdf

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
Signed-off-by: Akio Takebe <takebe_akio@jp.fujitsu.com>
17 years agobump libxenctrl and libxenguest versions
Keir Fraser [Fri, 23 Jan 2009 11:51:43 +0000 (11:51 +0000)]
bump libxenctrl and libxenguest versions

In c/s 19009 an incompatible change was made to the ABI of libelf-*,
which are included in libxenctrl and libxenguest.  To avoid client
programs (such as python/lowlevel/xc/xc.so) picking up a wrong
version and perhaps crashing, the soname should be changed.

I have chosen the version number 3.4 as xen-unstable is currently the
pre-3.4 branch.  I assume we don't care about API/ABI stability within
an unstable branch.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
17 years agox86: Support booting a bzImage format domain 0 kernel.
Keir Fraser [Thu, 22 Jan 2009 18:00:48 +0000 (18:00 +0000)]
x86: Support booting a bzImage format domain 0 kernel.

This requires a bzImage v2.08 or later kernel.

xen/common/inflate.c is taken unmodified from Linux v2.6.28.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
17 years agorombios: Simplify 32-bit gateway interface definitions.
Keir Fraser [Thu, 22 Jan 2009 17:41:13 +0000 (17:41 +0000)]
rombios: Simplify 32-bit gateway interface definitions.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agorombios: Simplify 32-bit gateway and avoid need for EBDA space.
Keir Fraser [Thu, 22 Jan 2009 16:32:06 +0000 (16:32 +0000)]
rombios: Simplify 32-bit gateway and avoid need for EBDA space.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agovmx: utilise the GUEST_PAT and HOST_PAT vmcs area
Keir Fraser [Thu, 22 Jan 2009 11:21:43 +0000 (11:21 +0000)]
vmx: utilise the GUEST_PAT and HOST_PAT vmcs area

Signed-off-by: Xin Li <Xin.Li@intel.com>
Signed-off-by: Xiaohui Xin <xiaohui.xin@intel.com>
17 years agox86 ucode: add S3 microcode update
Keir Fraser [Thu, 22 Jan 2009 11:17:48 +0000 (11:17 +0000)]
x86 ucode: add S3 microcode update

When wakeup from S3, use per cpu microcode image to update cpu
microcode.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
17 years agox86 ucode: optimizing microcode update
Keir Fraser [Thu, 22 Jan 2009 11:11:39 +0000 (11:11 +0000)]
x86 ucode: optimizing microcode update

It's possible the data file has multiple matching ucode, we needn't to
update multiple times, just keep searching the latest version, and
update once.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
17 years agox86 ucode: microcode logic update
Keir Fraser [Thu, 22 Jan 2009 11:11:10 +0000 (11:11 +0000)]
x86 ucode: microcode logic update

Update microcode logic:
1. separate microcode_fini_cpu() into 2 level to avoid deadlock (when
fail at microcode_update_cpu);
2. cancel redundant collect_cpu_info at microcode.c level, use
relative function at microcode driver level;
3. separate microcode_resume_cpu from microcode_update_cpu, because
it's redundant (should only be called when S3 wakeup) and will block newer
microcode update when user update newer microcode.dat from user level

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
17 years agox86 ucode: cancel redundant input parameter of microcode functions
Keir Fraser [Thu, 22 Jan 2009 11:10:04 +0000 (11:10 +0000)]
x86 ucode: cancel redundant input parameter of microcode functions

Cancel redundant input parameter 'uci', since it can get from another
input parameter 'cpu' as index.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
17 years agoxend: Fix do_FLR() scope problem.
Keir Fraser [Thu, 22 Jan 2009 11:07:32 +0000 (11:07 +0000)]
xend: Fix do_FLR() scope problem.

Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@ab.jp.nec.com>
17 years agox86: Make the num_siblings CPU parameter per-CPU.
Keir Fraser [Thu, 22 Jan 2009 11:05:54 +0000 (11:05 +0000)]
x86: Make the num_siblings CPU parameter per-CPU.

While it is unlikely that a system has a different number of siblings
for different physical CPUs,  make this parameter per-CPU for
consistency, and deal with the (so far theoretical) case that this is
different per CPU package.

Signed-off-by: Frank van der Linden <Frank.Vanderlinden@Sun.COM>
17 years agox86: Fix unmaskable MSI handling, and also some other EOI-notification issues.
Keir Fraser [Wed, 21 Jan 2009 14:44:43 +0000 (14:44 +0000)]
x86: Fix unmaskable MSI handling, and also some other EOI-notification issues.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agoxenoprof: dom0 hypercall could trigger Xen NULL-pointer access
Keir Fraser [Wed, 21 Jan 2009 11:58:01 +0000 (11:58 +0000)]
xenoprof: dom0 hypercall could trigger Xen NULL-pointer access

Signed-off-by: Xiaowei Yang <xiaowei.yang@intel.com>
17 years agox86, hvm: Limit output debug port to printable characters.
Keir Fraser [Tue, 20 Jan 2009 16:41:29 +0000 (16:41 +0000)]
x86, hvm: Limit output debug port to printable characters.

In particular, '\r' was causing output corruption, and it's not
actually needed.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agohvmloader: ACPI compiler is not to be buil;t and installed on target system.
Keir Fraser [Tue, 20 Jan 2009 15:10:28 +0000 (15:10 +0000)]
hvmloader: ACPI compiler is not to be buil;t and installed on target system.

Since it is a build prerequisite (in some cases) simply fail the build
if it is not found when it turns out to be required. Just as we would
for any other tool-chain prereq.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agopage_alloc: Clean up free_heap_pages and init_heap_pages interfaces.
Keir Fraser [Tue, 20 Jan 2009 14:30:42 +0000 (14:30 +0000)]
page_alloc: Clean up free_heap_pages and init_heap_pages interfaces.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86_32: Get rid of xenheap_phys_start as it is zero after start of day.
Keir Fraser [Tue, 20 Jan 2009 13:57:20 +0000 (13:57 +0000)]
x86_32: Get rid of xenheap_phys_start as it is zero after start of day.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: update microcode support
Keir Fraser [Tue, 20 Jan 2009 13:27:08 +0000 (13:27 +0000)]
x86: update microcode support

- Container header file holding the patches changed. Update to new
  format.
- in cpu_request_microcode() move heap re-allocation & copy out of the
  loop.
  Side-effect: Remove limitation in only supporting fixed sized
  microcode patches. Also simplifies code a lot.
- cleanup: use rdmsr and wrmsrl instead of inlined assembler
- pass ucode_cpu_info as arguments. Improves reentrancy.
- cleanup: simplify struct ucode_cpu_info and remove
  get_matching_microcode hook. Side-effect: reduces kernel size.
- bugfix: fix xen kernel memory leak in error path. equiv_cpu_table
  was not freed.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
17 years agopassthrough: fix typo
Keir Fraser [Tue, 20 Jan 2009 13:22:28 +0000 (13:22 +0000)]
passthrough: fix typo

The indentation level of the following code was incidentally
changed when event_lock was added to protect dpci.
It causes no issue but does look a little weird, so fix it.

Signed-off-by: Qing He <qing.he@intel.com>
17 years agopage_alloc: Fix x86_64's alloc_xenheap_pages() when system has >=4GB RAM.
Keir Fraser [Mon, 19 Jan 2009 17:40:28 +0000 (17:40 +0000)]
page_alloc: Fix x86_64's alloc_xenheap_pages() when system has >=4GB RAM.

Also do a few cleanups at the same time.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Tighten MSR access checks so only dom0 can access cpufreq MSRs,
Keir Fraser [Fri, 16 Jan 2009 15:43:59 +0000 (15:43 +0000)]
x86: Tighten MSR access checks so only dom0 can access cpufreq MSRs,
and then only when it is the cpufreq controller.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Let dom0 write MPERF/APERF MSRs if it is managing cpufreq.
Keir Fraser [Fri, 16 Jan 2009 15:32:12 +0000 (15:32 +0000)]
x86: Let dom0 write MPERF/APERF MSRs if it is managing cpufreq.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
17 years agox86_64: Remove statically-partitioned Xen heap.
Keir Fraser [Fri, 16 Jan 2009 15:12:12 +0000 (15:12 +0000)]
x86_64: Remove statically-partitioned Xen heap.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years agox86: Fix the 32-bit build.
Keir Fraser [Fri, 16 Jan 2009 13:17:53 +0000 (13:17 +0000)]
x86: Fix the 32-bit build.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
17 years ago[IA64] fix compilation error caused by 19046:ecf603780f56
Keir Fraser [Fri, 16 Jan 2009 11:47:21 +0000 (11:47 +0000)]
[IA64] fix compilation error caused by 19046:ecf603780f56

This patch fixes the following compilation error adjusting
function prototypes.

> xc_core_ia64.c:176: error: conflicting types for
  'xc_core_arch_memory_map_get'
> xc_core.h:141: error: previous declaration of
  'xc_core_arch_memory_map_get' was here
> xc_core_ia64.c:241: error: conflicting types for
  'xc_core_arch_map_p2m'
> xc_core.h:144: error: previous declaration of 'xc_core_arch_map_p2m'
  was here

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>